第三章 依赖注入

  • 从UML 角度理解依赖
    1. 什么是依赖(任务17)
      可以简单的理解,就是一个类A使用到了另外一个类B,而这种关系是具有偶然性、临时性的、非常脆肉,但是B类的变化会影响到A.
    2. 显式依赖与隐式依赖
    3. 依赖倒置原则
  • 控制反转
  • 单元测试
  • DI初始化的源码解读
  • 依赖注入的使用

    依赖注入的使用 博客文章 http://www.jessetalk.cn/2017/11/06/di-in-aspnetcore/

第四章ASP.NET Core HTTP 介绍

  • ASP.NET CORE-HTTP 处理过程
  • WebHost的配置与启动
    1. 覆盖配置文件
      项目=》调试=>引用程序参数
      配置文件:选择项目名称 启动:选择项目 应用程序参数填写:name=yumeng
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      代码:Startup.cs
      public void Configure(IApplicationBuilder app, IHostingEnvironment env,IConfiguration configuration)
      {
      if (env.IsDevelopment())
      {
      app.UseDeveloperExceptionPage();
      }
      app.Run(async (context) =>
      {
      //await context.Response.WriteAsync("Hello World!");
      //显示settin.json 值
      //await context.Response.WriteAsync(configuration["ConnectionStrings:DefaultConnection"]);
      //读取应用程序的参数
      await context.Response.WriteAsync($"name = {configuration["name"]}");
      });
      }
      }
  1. 更改启动的URL(友方链接:修改URL详细介绍)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
    //更改配置 默认读取appsettingjson.json 文件夹
    .ConfigureAppConfiguration(config =>
    {
    config.AddJsonFile("setting.json");
    //命令行引入
    config.AddCommandLine(args);
    })
    // .UseUrls("http://localhost:5001")
    .UseStartup<Startup>();
  2. IHostingEnvironment

  3. IApplicationLifetime
  4. dotnet watch rum
1
2


第五章 任务31

  • Cooie-based 认证与授权
  • cookie based 认证与实现
  • Jwt 认证与授权介绍
  • Jwt 认证与授权的实现
  • Jwt 认证与授权
  • Role based 授权
  • Claims-based授权
1.Cooie-based 认证与授权
2.Cooie-based 认证与授权
3.1Jwt 认证与授权介绍
3.2应用 JWTBearer Authenticationn
1.https://jwt.io
2.postman 调试api 工具
4.JWT 设计解析与定制
5.Role以及Clains 授权

2019-03-17 ASP.NET CORE MVC

任务 40-50

  • 41 individual authentication 模板
查看MVC的帮助
dotnet new MVC --help 
新建项目
dotnet new MVC -au individual -uld --name IdentityAample 
根据项目设置生产database
dotnet ef databae update
  • 42.EF Core Miagration

  • ASP.NET Core MVC -EF Migration




















































    序号 命令 英文解析 中文解析
    1.手动命令行的方式
    2.代码自动方式
    1 dotnet ef migrations add initialCreate Add Migration 添加迁移
    2 dotnet ef database update Update Database 更新数据模型
    3 dotnet ef migrations remove Remove MIgration 移除迁移
    4 dotnet ef database update Last GoodMigration Update Database LastGoodMigration 更新数据库上次良好的迁移
    5 dotnet ef migrations script Script Migration 脚本迁移
    6 dotnet ef migrations add VSinit
  • 43 Identity MVC UI
  • 44 Identity MVC :EF + identity 实现 登录注册
  • 45 Identity MVC :注册逻辑实现
  • 46 Identity MVC :登录逻辑实现
  • 47 Identity MVC :ReturnUrl 实现
  • 48 Identity MVC :Model 后端验证
  • 49 Identity MVC :Model 前端校验
  • 49 Identity MVC :DBContextSeed 初始化